<template>
    <H2>用户投资赎回列表</H2>
    <table class="table table-bordered">
        <thead>
            <tr style="background-color:cyan">
                <th>投资项目编号</th>
                <th>账号名称</th>
                <th>投资项目金额</th>
                <th>佣金已投金额</th>
                <th>赎回金额</th>
            </tr>
        </thead>
        <tbody>
            <tr v-for="item in data" :key="item.I_Id">
                <td>{{ item.I_Id }}</td>
                <td>{{ item.UL_Name }}</td>
                <td>{{ item.I_Budget }}</td>
                <td>{{ item.UI_Money }}</td>
                <td>{{ item.UIR_Money }}</td>
            </tr>
        </tbody>
    </table>
</template>

<script setup lang="ts">
import { ref, onMounted } from 'vue';
import axios from 'axios';
import { useRoute } from 'vue-router';

const route = useRoute();

const data=ref([{
    I_Id: 1,
    UL_Name: '',
    I_Budget: 0,
    UIR_Money: 0,
    UI_Money: 0
}])


console.log(route.query.id);
onMounted(() => {
    loadData();
})
//加载数据、
const loadData = () => {
    axios.get('https://localhost:44387/api/Invests/GetAllUserInvestInfo',
        {
            params: {
                I_Id: route.query.id
            }
        }
    ).then(res => {
        console.log(res.data);
        data.value = res.data;
    }
    ).catch(error => {
        console.log(error);
    }
    )
}
</script>